# Replication Package: Fear and Favoritism in the Time of COVID-19

## Authors
- Baran Han (World Bank)
- Benjamin Ho (Vassar College)
- Inbok Rhee (Yonsei University) - Corresponding Author
- Chrysostomos Tabakis (KAPSARC School of Public Policy)

**Last Updated:** 2024

## Overview

This replication package contains all data and code necessary to reproduce the tables and figures in "Fear and Favoritism in the Time of COVID-19." The study examines how experimentally induced fear affects prosocial behavior toward in-groups and out-groups using a survey experiment conducted in South Korea during the COVID-19 pandemic.

## Abstract

We investigate the effect of fear on intergroup discrimination using a pre-registered survey experiment with over 6,000 participants in South Korea during the COVID-19 pandemic. Subjects were randomly assigned to recall fearful or happy moments related to COVID-19. We find that the fear treatment increased prosocial behavior toward out-groups (foreign workers) while having no effect on in-group donations (Korean Red Cross). Using an instrumental variable approach, we show that reported fear causally increases out-group favoritism.

---

## Folder Structure

```
replication_package/
│
├── README.md                    # This file
│
├── data/                        # Data files
│   ├── survey_data.csv          # Main survey data (N=6,472, 32 variables)
│   ├── gps_measures.dta         # Global Preference Survey measures (7 variables)
│   ├── media_counts.dta         # Media consumption counts (3 variables)
│   └── neighbor_preferences.dta # WVS neighbor preference variables (8 variables)
│
├── code/                        # Analysis scripts
│   ├── master_replication.R     # R master script (tables + figures)
│   └── master_replication.do    # Stata master script (alternative)
│
└── output/                      # Output directory
    ├── tables/                  # Generated tables (CSV/LaTeX)
    └── figures/                 # Generated figures (PNG/PDF)
```

---

## Data Description

### Main Dataset: `survey_data.csv`

The main dataset contains 6,472 observations from a survey experiment conducted in December 2020.

#### Key Variables

| Variable | Description |
|----------|-------------|
| `id` | Unique respondent identifier |
| `gubun` | Treatment assignment (Fear vs. Happiness) |
| `gubun3` | Media treatment (1=Korean, 2=Korean-Chinese, 3=Chinese) |
| `q77` | Amount kept for self (out of 10,000 KRW) |
| `q77_n2` | Donation to foreign workers support center (out-group) |
| `q77_n3` | Donation to Korean Red Cross (in-group) |
| `q77_n4` | Total donation amount |
| `q110` | Clicked hyperlink to seek fundraiser information |
| `q81_0` | Reported fear level (manipulation check) |
| `q81_0_n2` through `q81_0_n6` | Other emotions (anger, happiness, sadness, disgust, surprise) |
| `sq1` | Sex |
| `sq2` | Age |
| `sq3` | Region |
| `sq4` | Education |
| `q66` | Political ideology |
| `q68` | Religion |
| `q82` through `q82_n6` | KGSS items: attitudes toward various groups |
| `q94_1` through `q94_7` | WVS items: unwanted neighbors |

### Auxiliary Datasets

| File | Description |
|------|-------------|
| `gps_measures.dta` | Global Preference Survey measures (time, risk, altruism, reciprocity, trust) |
| `media_counts.dta` | Media diversity counts (q105_count, q106_count) |
| `neighbor_preferences.dta` | WVS neighbor preference variables (q94_1 to q94_7) |

---

## Software Requirements

### Option 1: R (Recommended)

**R Version:** 4.0.0 or higher

**Required Packages:**
- `dplyr` - Data manipulation
- `haven` - Read Stata files
- `vtable` - Summary statistics
- `tidyr` - Data reshaping
- `broom` - Tidy model outputs
- `gt` - Table formatting
- `AER` - IV regression
- `texreg` - LaTeX tables
- `fixest` - Fixed effects estimation
- `forcats` - Factor handling
- `kableExtra` - Table formatting
- `mediation` - Causal mediation analysis
- `sandwich` - Robust standard errors
- `lmtest` - Hypothesis testing
- `stargazer` - Regression tables

Install all packages:
```r
install.packages(c("dplyr", "haven", "vtable", "tidyr", "broom", "gt",
                   "AER", "texreg", "fixest", "forcats", "kableExtra",
                   "mediation", "sandwich", "lmtest", "stargazer"))

# For word cloud generation (text_analysis.R):
install.packages(c("quanteda", "quanteda.textplots", "RColorBrewer"))
```

### Option 2: Stata

**Stata Version:** 15.0 or higher

**Required Packages:**
- `estout` - Regression table output
- `ivreg2` - IV regression

Install packages:
```stata
ssc install estout, replace
ssc install ivreg2, replace
```

---

## Instructions for Replication

### Using R

1. Open `code/master_replication.R` in RStudio

2. Modify the working directory path at the top of the script:
   ```r
   setwd("/path/to/replication_package")
   ```

3. Run the entire script. All tables will be saved to `output/tables/`

4. Expected runtime: ~2-5 minutes

### Using Stata

1. Open `code/master_replication.do` in Stata

2. Modify the global path at the top of the script:
   ```stata
   global root "/path/to/replication_package"
   ```

3. Execute the entire do-file. Tables will be saved to `output/tables/`

4. Expected runtime: ~2-5 minutes

---

## Table Mapping

### Main Paper Tables

| Table | Description | Code Section |
|-------|-------------|--------------|
| Table 1 | Summary Statistics and Balance Check | `TABLE 1` |
| Table 2 | Emotion Summary and Manipulation Check | `TABLE 2` |
| Table 3 | Main Results: Effects on Donations and Info-Seeking | `TABLE 3` |
| Table 4 | GPS Variables as Outcomes | `TABLE 4` |
| Table 5 | Mediation Analysis | `TABLE 5` |
| Table 6 | AEMT Text Analysis Results | `TABLE 6` (R only) |

### Appendix Tables

| Table | Description | Code Section |
|-------|-------------|--------------|
| Table A1 | Main Results with First 4,000 Observations | `TABLE A1` |
| Table A2 | Benjamini-Hochberg Corrected p-values | `TABLE A2` |
| Table A3 | Effects of Media Treatment | `TABLE A3` |
| Table A4 | Political Interactions | `TABLE A4` |
| Table A5 | Media Interactions | `TABLE A5` |
| Table A6 | KGSS Outcomes (Group Decrease) | `TABLE A6` |
| Table A7 | WVS Outcomes (Unwanted Neighbors) | `TABLE A7` |
| Table A8 | Global Values IV Analysis | `TABLE A8` |
| Table A9 | T-Test Results for GPS Variables | `TABLE A9` |

---

## Output Files Generated

After running the master script, the following files will be created:

```
output/tables/
├── table1_balance_check.csv/.tex   # Table 1: Summary and Balance Check
├── table2_manipulation_check.csv/.tex  # Table 2: Emotions + Manipulation Check
├── table3_main_results.csv         # Table 3: Main Results (all specifications)
├── table3_itt.tex                  # Table 3: ITT results (LaTeX)
├── table3_iv.tex                   # Table 3: IV results (LaTeX)
├── table4_gps_outcomes.csv         # Table 4: GPS Variables as Outcomes
├── table5_mediation.csv            # Table 5: Mediation Analysis
├── tableA1_first4000.csv           # Table A1: First 4,000 Observations
├── tableA2_bh_corrected.csv        # Table A2: BH Corrected P-values
├── tableA3_media_treatment.csv     # Table A3: Media Treatment Effects
├── tableA4_political_interactions.csv  # Table A4: Political Interactions
├── tableA5_media_interactions.csv  # Table A5: Media Interactions
├── tableA6_kgss.csv                # Table A6: KGSS Outcomes
├── tableA7_wvs.csv                 # Table A7: WVS Outcomes
├── tableA8_gps_iv.csv              # Table A8: Global Values IV
└── tableA9_ttest.csv               # Table A9: T-Test GPS Variables

Note: Tables 1-3 are generated in both CSV and LaTeX (.tex) formats.
The .tex files can be directly included in LaTeX documents using \\input{}.

output/figures/
├── Word Cloud of the Pooled AMET (Fear).png        # Figure A1 left (appendix)
└── Word Cloud by Economics, Health, and Others.png # Figure A1 right (appendix)
```

---

## Figure Generation

### Figure A1: Word Clouds
The word cloud figures are generated from open-ended survey responses (Q74: fear-related text) that were:
1. Translated from Korean to English using Google Translate API
2. Classified into categories (Economic, Health, Other) by research assistants

**Regenerating Word Clouds:**
- Word cloud generation code is included in `code/master_replication.R`
- Requires the `quanteda` and `quanteda.textplots` R packages
- The translated/classified data file (`fear_translated.csv`) is not included due to Google Translate API licensing

The pre-generated figures are provided in `output/figures/`:
- `Word Cloud of the Pooled AMET (Fear).png` - All fear text responses
- `Word Cloud by Economics, Health, and Others.png` - Comparison by cause category

---

## Variable Coding Notes

### Treatment Assignment
- **Fear Treatment** (`treat=1`): Subjects recalled fearful moments related to COVID-19
- **Happiness Treatment** (`treat=0`): Subjects recalled happy moments related to COVID-19

### Donation Task
Subjects were given 10,000 KRW and asked to allocate it among:
- Keeping for themselves
- Donating to Korea Support Center for Foreign Workers (out-group)
- Donating to Korean Red Cross (in-group)

### Political Ideology Scale
1 = Very liberal
2 = Somewhat liberal
3 = Moderate
4 = Somewhat conservative
5 = Very conservative

Note: The ruling party at the time of the survey was the liberal Democratic Party.

### Emotion Measures (4-point scale)
1 = Not at all
2 = A little
3 = Somewhat
4 = Very much

---

## Computational Notes

- All standard errors are heteroskedasticity-robust (HC1)
- IV estimation uses 2SLS with the fear treatment as an instrument for reported fear
- Mediation analysis uses quasi-Bayesian Monte Carlo with 1,000 simulations
- Missing values are handled using listwise deletion

---

## Pre-Registration

This study was pre-registered at [provide registry link if available].

The pre-analysis plan specified:
- Primary outcomes: Donation allocation, hyperlink click behavior
- Sample size: 4,000 (later expanded to 6,472)
- Main specifications: ITT, OLS with reported fear, IV estimation

---

## Contact

For questions about the replication package, please contact:
Inbok Rhee (inbok.rhee@yonsei.ac.kr)
Department of Political Science and International Studies
Yonsei University, Seoul, Republic of Korea

---

## License

This replication package is provided for academic research purposes. Please cite the paper when using this data or code.

## Citation

```bibtex
@article{han2024fear,
  title={Fear and Favoritism in the Time of COVID-19},
  author={Han, Baran and Ho, Benjamin and Rhee, Inbok and Tabakis, Chrysostomos},
  journal={Politics and the Life Sciences},
  year={2024}
}
```
